import moment from "moment"
import calendarFormatter from "./lunarChange.js"

/**
 * 获取当前时间
 * @param params
 * @returns {String}
 */
export function getTime() {
  return moment().format('HH:mm')
}

/**
 * 获取农历时间
 * @param params
 * @returns {Object}
 */
export function getNongli() {
  let yy = moment().format('YYYY')
  let mm = moment().format('M')
  let dd = moment().format('D')
  return calendarFormatter.solar2lunar(yy, mm, dd)
}

/**
 * 获取date对象
 * @param params
 * @returns {Object}
 */
export function getDateMap() {
  const { IMonthCn, IDayCn, gzYear, cYear, cMonth, cDay, ncWeek, Term} = getNongli()
  return {
    currentWeek: ncWeek,
    currentDate: `${cYear}/${cMonth}/${cDay}`,
    currentLunarYear: gzYear,
    currentLunarDate: IMonthCn + IDayCn,
    currentTerm: Term
  }
}